package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the TERRITORY database table.
 * 
 */
@Entity
public class Territory implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="TERRITORY_ID")
	private long territoryId;

	@Column(name="TERRITORY_NAME")
	private String territoryName;

	//bi-directional many-to-one association to CustomerRepresentative
	@OneToMany(mappedBy="territory")
	private List<CustomerRepresentative> customerRepresentatives;

	//bi-directional many-to-one association to TerritoryState
	@OneToMany(mappedBy="territory")
	private List<TerritoryState> territoryStates;

	public Territory() {
	}

	public long getTerritoryId() {
		return this.territoryId;
	}

	public void setTerritoryId(long territoryId) {
		this.territoryId = territoryId;
	}

	public String getTerritoryName() {
		return this.territoryName;
	}

	public void setTerritoryName(String territoryName) {
		this.territoryName = territoryName;
	}

	public List<CustomerRepresentative> getCustomerRepresentatives() {
		return this.customerRepresentatives;
	}

	public void setCustomerRepresentatives(List<CustomerRepresentative> customerRepresentatives) {
		this.customerRepresentatives = customerRepresentatives;
	}

	
	public CustomerRepresentative addCustomerRepresentatives(CustomerRepresentative customerRepresentatives) {
		getCustomerRepresentatives().add(customerRepresentatives);
		customerRepresentatives.setTerritory(this);

		return customerRepresentatives;
	}

	public CustomerRepresentative removeCustomerRepresentatives(CustomerRepresentative customerRepresentatives) {
		getCustomerRepresentatives().remove(customerRepresentatives);
		customerRepresentatives.setTerritory(null);

		return customerRepresentatives;
	}
	public List<TerritoryState> getTerritoryStates() {
		return this.territoryStates;
	}

	public void setTerritoryStates(List<TerritoryState> territoryStates) {
		this.territoryStates = territoryStates;
	}

	
	public TerritoryState addTerritoryStates(TerritoryState territoryStates) {
		getTerritoryStates().add(territoryStates);
		territoryStates.setTerritory(this);

		return territoryStates;
	}

	public TerritoryState removeTerritoryStates(TerritoryState territoryStates) {
		getTerritoryStates().remove(territoryStates);
		territoryStates.setTerritory(null);

		return territoryStates;
	}
}